﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShowTeams.aspx.cs" Inherits="Actuals.ShowTeams" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
     <link href="~/Actuals.css" rel="Stylesheet" type="text/css" />

      <script type="text/javascript">


          function ShowAddTeam() {

              var url = 'AddTeam.aspx';
              var result = window.showModalDialog(url, this,
                'dialogHeight:600px;dialogWidth:600px;Status:yes;Toolbars:no;Scroll:yes;Help:no;Center:yes;');
              __doPostBack('refresh', 'refresh');
          }


          function UpdateAddTeam(teamId) {


              var url = 'AddTeam.aspx?Mode=Edit&TeamId=' + teamId;

              var result = window.showModalDialog(url, this, 'dialogHeight:600px;dialogWidth:600px;Status:yes;Toolbars:no;Scroll:yes;Help:no;Center:yes;');
              __doPostBack('refresh', 'refresh');
          }

          function TestCheckBox() {

              var Target = null;
              Target = document.getElementById('<% = this.gvResults.ClientID %>');
              if (Target == null) {
                  alert("No record is selected.Please select!");
                  return false;
              }
              var Inputs = Target.getElementsByTagName("input");
              for (var n = 0; n < Inputs.length; ++n) {
                  if (Inputs[n].type == 'checkbox' && Inputs[n].checked) {
                      return confirm("Do you want to Delete?");
                  }

              }
              alert("no record is selected.Please select!");
              return false;
          }
         </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
     <center>
      <div>
            <asp:Label ID="Label2" runat="server" CssClass="ParaTitle">Teams </asp:Label>
        </div>

    <asp:Label ID="lblMsg" runat="server" CssClass="message"></asp:Label>
    <div id="divGrid" style="border: solid 1px silver; height: 400px; text-align: center;
                overflow-x: hidden; overflow-y: auto;">
                <asp:GridView ID="gvResults" runat="server" AutoGenerateColumns="false" BorderColor="Black"
                    AllowPaging="false" AllowSorting="true" ShowFooter="true" OnRowCommand="gvResults_OnRowCommand" >
                    <HeaderStyle BackColor="White" Font-Size="10px" ForeColor="#990000" BorderStyle="None" />
                    <RowStyle BackColor="#F7F3F7" Font-Names="Verdana" Font-Size="XX-Small" BorderStyle="None" />
                    <AlternatingRowStyle BackColor="White" Font-Names="Verdana" Font-Size="XX-Small"
                        BorderStyle="None" />
                    <Columns>
                        <asp:TemplateField HeaderStyle-Width="5%" ItemStyle-Width="5%" ItemStyle-BorderStyle="None"
                            HeaderStyle-BorderStyle="None">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkShowTeam" runat="server" AutoPostBack="false" />
                            </ItemTemplate>
                        </asp:TemplateField>
                           <asp:TemplateField Visible="false">
                            <ItemTemplate>
                                <asp:Label ID="lblTeamId" runat="server" Text='<%# Bind("TeamId") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="TeamDescription" HeaderText="Team Description" />
                    
                        <asp:TemplateField HeaderStyle-Width="5%" ItemStyle-Width="5%" ItemStyle-BorderStyle="None"
                            HeaderStyle-BorderStyle="None">
                            <ItemTemplate>
                                <asp:Button ID="btnEdit" runat="server" Text="Edit" CommandName="EditTeam" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"TeamId") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
    </div>

       <asp:Button ID="btnAddTeam" runat="server" Text="AddTeam" CssClass="button"
                OnClientClick="return ShowAddTeam();" />
                <asp:Button ID="btnDelete" runat="server" CssClass="button" Text="Delete" OnClientClick="return TestCheckBox()"
            OnClick="btnDeleteTeam_Click" />

            </center>
    </div>
    </form>
</body>
</html>
